package cn.pengyinrui.department.system.emp.service.impl;

import cn.pengyinrui.department.system.emp.domain.Employee;
import cn.pengyinrui.department.system.emp.service.IEmployeeService;
import cn.pengyinrui.department.base.service.impl.BaseServiceImpl;
import cn.pengyinrui.department.system.emp.mapper.EmployeeMapper;
import cn.pengyinrui.department.system.register.domain.Register;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author peng.yr
 * @since 2023-01-20
 */
@Service
public class EmployeeServiceImpl extends BaseServiceImpl<Employee> implements IEmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;
    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public Employee findOneByPhone(String phone) {
        return employeeMapper.findOneByPhone(phone);
    }

    @Override
    public Employee findOneByEmail(String email) {
        return employeeMapper.findOneByEmail(email);
    }

    @Override
    public void addByEmail(Register register) {
        Employee emp = new Employee();
        BeanUtils.copyProperties(register,emp);
        employeeMapper.add(emp);
    }
}
